import java.util.Scanner;

public class test1 {
    public static void main(String[] args) {
        //卖飞机票问题

        //1 键盘录入 票价 月份 舱体类型
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入机票的票价");
        int ticket = sc.nextInt();
        System.out.println("请输入月份");
        int month = sc.nextInt();
        System.out.println("请输入 ：0 表示头等舱 1 表示经济舱");
        int seat = sc.nextInt();
        //2 判断是淡季还是旺季
        if (month >= 5 && month <= 10) {
            //代表旺季
            ticket = GetPrice(ticket, seat, 0.9, 0.85);
        } else if (month >= 1 && month <= 4 || month >= 11 && month <= 12) {
            //淡季
            ticket = GetPrice(ticket, seat, 0.7, 0.65);
        }

        //输出结果
        System.out.println("价格为" + ticket);
    }

    //封装成方法
    public static int GetPrice(int ticket, int seat, double v1, double v2) {
        if (seat == 0) {
            ticket = (int) (ticket * v1);
        } else if (seat == 1) {
            ticket = (int) (ticket * v2);
        } else {
            System.out.println("键盘输入非法");
        }

        return ticket;
    }
}
